class TasksdescController < ApplicationController
before_filter :authorize
    layout "websitesinfo"
    
      active_scaffold :tasksdesc do |config|
      #config.actions = [:list, :nested]
  config.label = "Tasks Information"

  	  config.columns = [:name,:ecomments1,:last_accessed_at,:last_accessed_user,:last_updated_at,:last_updated_user]	
		 config.columns[:name].label ="Tasks description"
		 config.columns[:ecomments1].label ="Editors comments"
   config.nested.add_link("Tasks's subtasks", [:subtasksdescs]) 
   		 config.columns[:subtasksdescs].search_sql = "CONCAT(subtasksdescs.descocont1,subtasksdescs.commocont1,subtasksdescs.conturl1,subtasksdescs.searterm1,subtasksdescs.uname1,subtasksdescs.upwd1,subtasksdescs.name)"    
		 config.search.columns << :subtasksdescs 
    config.columns[:ecomments1].form_ui = :textarea
    config.columns[:ecomments1].options = {:rows => 90, :cols => 150}		 
    config.create.columns.exclude(:last_accessed_at,:last_accessed_user,:last_updated_at,:last_updated_user)  
    
       	
    config.update.columns.exclude(:last_accessed_at,:last_accessed_user,:last_updated_at,:last_updated_user)  
	 
  end
  
  def show
  super

    @tasksdesc = Tasksdesc.find(params[:id])
    @tasksdesc.last_accessed_user = User.find(session[:user_id]).name + " action show"
    @tasksdesc.last_accessed_at = Time.now
    @tasksdesc.save

  end  
  
    def update

  super

    @tasksdesc = Tasksdesc.find(params[:id])
    @tasksdesc.last_updated_user = User.find(session[:user_id]).name + " action update"
    @tasksdesc.last_updated_at = Time.now
    @tasksdesc.save

  end  
  
  def do_edit
  super

    @tasksdesc = Tasksdesc.find(params[:id])
    @tasksdesc.last_accessed_user = User.find(session[:user_id]).name + " action edit"
    @tasksdesc.last_accessed_at = Time.now
    @tasksdesc.save

  end
  
  def do_nested
  super

    @tasksdesc = Tasksdesc.find(params[:id])
    @tasksdesc.last_accessed_user = User.find(session[:user_id]).name + " action subtasks"
    @tasksdesc.last_accessed_at = Time.now
    @tasksdesc.save

  end  
end
